﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:local="clr-namespace:CompleteSample">

	<Style x:Key="{x:Type local:DropdownMenu}" TargetType="local:DropdownMenu">
		<Setter Property="Background" Value="Black" />
		<Setter Property="Foreground" Value="WhiteSmoke" />
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="local:DropdownMenu">
					<ComboBox x:Name="comboBox" Focusable="False"
							Background="{TemplateBinding Background}"
							Foreground="{TemplateBinding Foreground}">
						<ComboBox.Template>
							<ControlTemplate TargetType="ComboBox">
								<Grid
										DataContext="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:DropdownMenu}}">
									<ToggleButton Focusable="False" Content="{Binding MenuName}"
											Foreground="{TemplateBinding Foreground}"
											IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" />
									<Popup PlacementTarget="{Binding ElementName=comboBox}"
											IsOpen="{TemplateBinding IsDropDownOpen}"
											Placement="Bottom" AllowsTransparency="True">
										<Grid Background="Transparent" Margin="0,5,0,0">
											<Border BorderThickness="1" BorderBrush="WhiteSmoke"
													Background="{TemplateBinding Background}">
												<ContentControl Content="{Binding Content}"
														Margin="5" Background="#20ffffff" />
											</Border>
										</Grid>
									</Popup>
								</Grid>
							</ControlTemplate>
						</ComboBox.Template>
					</ComboBox>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>